A continuación se desarrollarán gráficos y estadísticos de datos sobre la calidad del café. Estos gráficos estarán basados en datos del país de origen, variedad, color, altitud y el total de puntos de copa. Para esto, tomamos de referencia del repositorio Fatih Boyar , donde los datos utilizados provienen del Instituto de Calidad de Café [Coffe Quality Institute (CQI)].
library(tidyverse)
library(plotly)
library(DT)
library(gapminder)
library(ggthemes)
library(hrbrthemes)
library(ggplot2)
library(readr)
tabla <- "https://raw.githubusercontent.com/gf0604-procesamientodatosgeograficos/2023-i/main/datos/cqi/coffee-quality.csv"
data <- read.csv(tabla)
datatable(data[, c(
"Country_of_Origin",
"Variety",
"Color",
"Altitude",
"Total_Cup_Points")],
options = list(pageLength = 10, lengthMenu = c(10, 20, 50)),
rownames = FALSE)
histograma <-
ggplot(data, aes(x = Total_Cup_Points)) +
geom_histogram(
aes(
text = paste0(
"Distribución", round(after_stat(x), 2), "\n",
"Frecuencia: ", after_stat(count)
),
y = after_stat(density)
),
bins = 10
) +
geom_density() +
scale_y_continuous(labels = scales::label_comma()) +
labs(x = "Total", y = "Frecuencia",
title = "Distribución de Total") +
theme_solarized_2()
ggplotly(histograma, tooltip = "text") |>
config(locale = 'es')
dispersion <-
ggplot(data, aes(x = Altitude, y = Total_Cup_Points)) +
geom_point(aes(
text = paste0(
"País: ", Country_of_Origin, "\n",
"Altitud:", round(Altitude, 2), "\n",
"Puntaje Total:", round(Total_Cup_Points, 2), "\n"
)
)) +
geom_smooth(method = "lm") +
ggtitle("Altitud vs Total") +
xlab("Altitud") +
ylab("Puntaje Total") +
theme_solarized_2()
ggplotly(dispersion, tooltip = "text") |>
config(locale = 'es')
caja <- ggplot(data, aes(x = Color, y = Total_Cup_Points)) +
geom_boxplot() +
ggtitle("Distribución del Puntaje Total por los Colores") +
xlab("Color") +
ylab("Puntaje Total") +
theme_solarized_2()
ggplotly(caja) |>
config(locale = 'es')